#
# object.py -- rendering objects (debug only)
# 
# author: Tom "Knio" Flanagan
#         knio@h4xn3t.net
#         theknio@gmail.com
#         irc.freenode.net - Knio - #python #pygame #py
#
# this file released under Public Domain
#

from constants import *

class Object:
    def __init__(self, view, model):
        self.model = model
        self.color = pygame.Color(self.model.color)
        self.view = view
        self.rect = pygame.Rect(0,0,self.model.size,self.model.size)
        self.__class__ = globals()[self.model.__class__.__name__]
        self.init()
        
    def init(self):
        pass

    def tick(self):
        self.view.dirty.append(pygame.Rect(self.rect))
        self.rect.centerx = self.view.offset+self.model.x
        self.rect.centery = self.view.offset-self.model.y
        self.view.dirty.append(pygame.Rect(self.rect))
        self.view.screen.fill(self.color, self.rect)

from ship       import Ship
from explosion  import Explosion
from weapon     import Laser, MissileLauncher
from scrap      import Scrap
from missile    import Missile
